from redis import StrictRedis

class Config:
    DEBUG = None
    #设置秘钥
    SECRET_KEY = '123'
    #链接数据库
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info4'
    #配置数据库的动态追踪修改
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    #定义redis的主机和port
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    #配置状态保持的session信息
    SESSION_TYPE = 'redis'
    #配置session签名
    SESSION_UES_SIGNER = True
    #构造redis实力
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    #配置session过期时间
    PERMANENT_SESSION_LIFETIME = 86400

#   开发模式下
class developmentConfig(Config):
    DEBUG = True
#生产模式下
class productionConfig(Config):
    DEBUG = False

config = {
    'development':developmentConfig,
    'production':productionConfig
}


